﻿namespace HuiLian.Generate
{
    /// <summary>
    /// 生成代码时的参数
    /// </summary>
    internal class CodeArgs
    {
        /// <summary>
        /// 模板全文件名
        /// </summary>
        public string TemplateFile { get; set; }
        /// <summary>
        /// 实体名称
        /// </summary>
        public string EntityName { get; set; }
        /// <summary>
        /// 实体名称，首字母小写
        /// </summary>
        public string FirstLetterToLower
        {
            get
            {
                if (string.IsNullOrEmpty(EntityName)) return EntityName;
                return string.Concat(EntityName[..1].ToLower(), EntityName.AsSpan(1));
            }
        }
        /// <summary>
        /// 保存的文件全名
        /// </summary>
        public string SaveFile { get; set; }

        /// <summary>
        /// 保存的文件路径
        /// </summary>
        public string SavePath
        {
            get
            {
                return Path.GetDirectoryName(SaveFile);
            }
        }

        /// <summary>
        /// 文件存在时是否覆盖
        /// </summary>
        public bool Overflow { get; set; }
        /// <summary>
        /// 命令空间
        /// </summary>
        public string Namespace { get; internal set; } = string.Empty;
    }
}
